load("@rules_pkg//pkg:mappings.bzl", "pkg_filegroup", "pkg_files")
load("@semmle_code//:dist.bzl", "dist", "pack_zip")
load("//:defs.bzl", "codeql_platform")

package(default_visibility = ["//visibility:public"])

alias(
    name = "dbscheme",
    actual = "//python/ql/lib:dbscheme",
)

alias(
    name = "dbscheme-stats",
    actual = "//python/ql/lib:dbscheme-stats",
)

pkg_files(
    name = "dbscheme-group",
    srcs = [
        ":dbscheme",
        ":dbscheme-stats",
    ],
    strip_prefix = None,
)

pkg_filegroup(
    name = "db-files",
    srcs = [
        ":dbscheme-group",
        "//python/downgrades",
    ],
)

pkg_files(
    name = "codeql-extractor-yml",
    srcs = ["codeql-extractor.yml"],
    strip_prefix = None,
)

dist(
    name = "extractor-generic",
    srcs = [
        ":codeql-extractor-yml",
        ":dbscheme-group",
        "//python/downgrades",
        "//python/extractor",
        "//python/tools",
    ],
    prefix = "python",
    visibility = ["//visibility:public"],
)

pack_zip(
    name = "extractor-arch",
    srcs = [
        "//python/extractor/tsg-python",
    ],
    package_file_name = "extractor-" + codeql_platform + ".zip",
    prefix = "python/tools/" + codeql_platform,
    visibility = ["//visibility:public"],
)
